FROM microsoft/aspnetcore:2.0 AS base
WORKDIR /app
EXPOSE 80

FROM microsoft/aspnetcore-build:2.0 AS build
WORKDIR /src
COPY ["ECMS.Manage/ECMS.Manage.csproj", "ECMS.Manage/"]
COPY ["ECMS.BootStrapper/ECMS.BootStrapper.csproj", "ECMS.BootStrapper/"]
COPY ["ECMS.Infrastructure/ECMS.Infrastructure.csproj", "ECMS.Infrastructure/"]
COPY ["ECMS.AppService/ECMS.AppService.csproj", "ECMS.AppService/"]
COPY ["ECMS.Domain/ECMS.Domain.csproj", "ECMS.Domain/"]
COPY ["ECMS.AppService.Model/ECMS.AppService.Model.csproj", "ECMS.AppService.Model/"]
RUN dotnet restore "ECMS.Manage/ECMS.Manage.csproj"
COPY . .
WORKDIR "/src/ECMS.Manage"
RUN dotnet build "ECMS.Manage.csproj" -c Release -o /app

FROM build AS publish
RUN dotnet publish "ECMS.Manage.csproj" -c Release -o /app

FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "ECMS.Manage.dll"]